Optimal. Leaf size=37 \[ \frac {1}{2} \cos (2 a) \text {Ci}\left (\frac {2 b}{x}\right )+\frac {\log (x)}{2}-\frac {1}{2} \sin (2 a) \text {Si}\left (\frac {2 b}{x}\right ) \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.03, antiderivative size = 37, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 4, integrand size = 14, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3506, 3459,
3457, 3456} \begin {gather*} \frac {1}{2} \cos (2 a) \text {CosIntegral}\left (\frac {2 b}{x}\right )-\frac {1}{2} \sin (2 a) \text {Si}\left (\frac {2 b}{x}\right )+\frac {\log (x)}{2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3456
Rule 3457
Rule 3459
Rule 3506
Rubi steps
\begin {align*} \int \frac {\sin ^2\left (a+\frac {b}{x}\right )}{x} \, dx &=\int \left (\frac {1}{2 x}-\frac {\cos \left (2 a+\frac {2 b}{x}\right )}{2 x}\right ) \, dx\\ &=\frac {\log (x)}{2}-\frac {1}{2} \int \frac {\cos \left (2 a+\frac {2 b}{x}\right )}{x} \, dx\\ &=\frac {\log (x)}{2}-\frac {1}{2} \cos (2 a) \int \frac {\cos \left (\frac {2 b}{x}\right )}{x} \, dx+\frac {1}{2} \sin (2 a) \int \frac {\sin \left (\frac {2 b}{x}\right )}{x} \, dx\\ &=\frac {1}{2} \cos (2 a) \text {Ci}\left (\frac {2 b}{x}\right )+\frac {\log (x)}{2}-\frac {1}{2} \sin (2 a) \text {Si}\left (\frac {2 b}{x}\right )\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.04, size = 32, normalized size = 0.86 \begin {gather*} \frac {1}{2} \left (\cos (2 a) \text {Ci}\left (\frac {2 b}{x}\right )+\log (x)-\sin (2 a) \text {Si}\left (\frac {2 b}{x}\right )\right ) \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.05, size = 36, normalized size = 0.97
method | result | size |
derivativedivides | \(-\frac {\ln \left (\frac {b}{x}\right )}{2}-\frac {\sinIntegral \left (\frac {2 b}{x}\right ) \sin \left (2 a \right )}{2}+\frac {\cosineIntegral \left (\frac {2 b}{x}\right ) \cos \left (2 a \right )}{2}\) | \(36\) |
default | \(-\frac {\ln \left (\frac {b}{x}\right )}{2}-\frac {\sinIntegral \left (\frac {2 b}{x}\right ) \sin \left (2 a \right )}{2}+\frac {\cosineIntegral \left (\frac {2 b}{x}\right ) \cos \left (2 a \right )}{2}\) | \(36\) |
risch | \(\frac {i {\mathrm e}^{-2 i a} \pi \,\mathrm {csgn}\left (\frac {b}{x}\right )}{4}-\frac {i {\mathrm e}^{-2 i a} \sinIntegral \left (\frac {2 b}{x}\right )}{2}-\frac {{\mathrm e}^{-2 i a} \expIntegral \left (1, -\frac {2 i b}{x}\right )}{4}-\frac {{\mathrm e}^{2 i a} \expIntegral \left (1, -\frac {2 i b}{x}\right )}{4}+\frac {\ln \left (x \right )}{2}\) | \(68\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [C] Result contains complex when optimal does not.
time = 0.34, size = 51, normalized size = 1.38 \begin {gather*} \frac {1}{4} \, {\left ({\rm Ei}\left (\frac {2 i \, b}{x}\right ) + {\rm Ei}\left (-\frac {2 i \, b}{x}\right )\right )} \cos \left (2 \, a\right ) + \frac {1}{4} \, {\left (i \, {\rm Ei}\left (\frac {2 i \, b}{x}\right ) - i \, {\rm Ei}\left (-\frac {2 i \, b}{x}\right )\right )} \sin \left (2 \, a\right ) + \frac {1}{2} \, \log \left (x\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.36, size = 39, normalized size = 1.05 \begin {gather*} \frac {1}{4} \, {\left (\operatorname {Ci}\left (\frac {2 \, b}{x}\right ) + \operatorname {Ci}\left (-\frac {2 \, b}{x}\right )\right )} \cos \left (2 \, a\right ) - \frac {1}{2} \, \sin \left (2 \, a\right ) \operatorname {Si}\left (\frac {2 \, b}{x}\right ) + \frac {1}{2} \, \log \left (x\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 1.35, size = 31, normalized size = 0.84 \begin {gather*} \frac {\log {\left (x \right )}}{2} - \frac {\sin {\left (2 a \right )} \operatorname {Si}{\left (\frac {2 b}{x} \right )}}{2} + \frac {\cos {\left (2 a \right )} \operatorname {Ci}{\left (\frac {2 b}{x} \right )}}{2} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 65 vs.
\(2 (31) = 62\).
time = 4.77, size = 65, normalized size = 1.76 \begin {gather*} \frac {b \cos \left (2 \, a\right ) \operatorname {Ci}\left (-2 \, a + \frac {2 \, {\left (a x + b\right )}}{x}\right ) + b \sin \left (2 \, a\right ) \operatorname {Si}\left (2 \, a - \frac {2 \, {\left (a x + b\right )}}{x}\right ) - b \log \left (-a + \frac {a x + b}{x}\right )}{2 \, b} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.03 \begin {gather*} \int \frac {{\sin \left (a+\frac {b}{x}\right )}^2}{x} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________